package com.mstanford.movie.controller;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mstanford.movie.dao.MovieDao;


public class ChangePwdServlet extends HttpServlet  {

	private static final long serialVersionUID = 1L;
	protected void service(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException{
		res.setCharacterEncoding("utf-8");
		
		String memberId = req.getParameter("id");
		String pwd = req.getParameter("truePwd");
		MovieDao dao = new MovieDao();
		dao.updateMemberPwd(memberId, pwd);
		res.setCharacterEncoding("gbk");
		PrintWriter out=res.getWriter();
		out.print("<script>alert('修改成功!请重新登录。。。'); location='exit' ;</script>");
		out.flush();
		out.close();
	}
}
